<template>
	<view class="list">
		<view class="item" :class="{'itemAc':item.id == activeText}" v-for="item in list" @click="go(item)"
			:key="item.id">
			<image v-if="item.id == activeText" :src="item.iconAc"></image>
			<image v-else :src="item.icon"></image>
			<text>{{item.name}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		name: "Tab_nav",
		props: {
			active: {
				type: String,
				default: 1
			}
		},
		data() {
			return {
				activeText: this.active,
				list: [
					{
						name: '状态',
						icon: '../../static/icon/1.png',
						iconAc: '../../static/icon/1Ac.png',
						url: '/pages/deviceState/index',
						id: 1
					},
					{
						name: '记录',
						icon: '../../static/icon/2.png',
						iconAc: '../../static/icon/2Ac.png',
						url: '/pages/operationRecord/index',
						id: 2
					},
					{
						name: '设置',
						icon: '../../static/icon/3.png',
						iconAc: '../../static/icon/3Ac.png',
						url: '/pages/parameterSettings/index',
						id: 3
					},
					{
						name: '多功能',
						icon: '../../static/icon/4.png',
						iconAc: '../../static/icon/4Ac.png',
						url: '/pages/addressInfoSettings/index',
						id: 4
					}

				]
			};
		},
		methods: {
			go(item) {
				this.activeText = item.id
				uni.navigateTo({
					url: item.url
				})
			}
		},

	}
</script>

<style lang="less">
	.list {
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100vw;
		display: flex;
		background: #ffffff;

		.item {
			flex: 1;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			height: 56px;

			image {
				width: 14px;
				height: 14px;
			}

			text {
				color: #9CA3AF;
				margin-top: 4px;
				font-size: 10.5px;
				font-weight: normal;
				line-height: 14px;
				letter-spacing: 0px;
			}
		}

		.itemAc {
			text {
				color: #3B82F6;
			}
		}
	}
</style>